/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Wyniki.java
 *
 * Created on 2010-12-21, 08:00:16
 */

package alggen;

/**
 *
 * @author Jedrek
 */
public class WynikiWindow extends javax.swing.JFrame {

    MyCanvas2 canvas;
    public boolean live = false;
    /** Creates new form Wyniki */
    public WynikiWindow(MyCanvas2 canvas) {
        initComponents();
        this.canvas = canvas;
        this.canvasPanel.add(canvas);
        this.setVisible(true);
        live = true;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        canvasPanel = new javax.swing.JPanel();
        wholePopCheckBox = new javax.swing.JCheckBox();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Wyniki");
        setResizable(false);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosed(java.awt.event.WindowEvent evt) {
                formWindowClosed(evt);
            }
        });

        canvasPanel.setPreferredSize(new java.awt.Dimension(600, 500));

        javax.swing.GroupLayout canvasPanelLayout = new javax.swing.GroupLayout(canvasPanel);
        canvasPanel.setLayout(canvasPanelLayout);
        canvasPanelLayout.setHorizontalGroup(
            canvasPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 600, Short.MAX_VALUE)
        );
        canvasPanelLayout.setVerticalGroup(
            canvasPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 500, Short.MAX_VALUE)
        );

        wholePopCheckBox.setText("Wyświetl winiki poszczególnych populacji");
        wholePopCheckBox.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                wholePopCheckBoxStateChanged(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(wholePopCheckBox)
                    .addComponent(canvasPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(canvasPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 3, Short.MAX_VALUE)
                .addComponent(wholePopCheckBox))
        );

        getAccessibleContext().setAccessibleName("WynikiWindow");

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void wholePopCheckBoxStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_wholePopCheckBoxStateChanged
        if(wholePopCheckBox.isSelected())
            canvas.wholePop = true;
        else
            canvas.wholePop = false;
        canvas.invalidate();
        canvas.repaint();
    }//GEN-LAST:event_wholePopCheckBoxStateChanged

    private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed
        live = false;
    }//GEN-LAST:event_formWindowClosed

    /**
    * @param args the command line arguments
    */
//    public static void main(String args[]) {
//        java.awt.EventQueue.invokeLater(new Runnable() {
//            public void run() {
//                new Wyniki().setVisible(true);
//            }
//        });
//    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel canvasPanel;
    private javax.swing.JCheckBox wholePopCheckBox;
    // End of variables declaration//GEN-END:variables

}
